import { Category } from '@/api/home'

export default {
  namespaced: true,

  state() {
    return {
      categorys: [
        { id: '1005000', name: '居家' },
        { id: '1005002', name: '美食' },
        { id: '1010000', name: '服饰' },
        { id: '1011000', name: '母婴' },
        { id: '1013001', name: '个护' },
        { id: '1019000', name: '严选' },
        { id: '1043000', name: '数码' },
        { id: '109243029', name: '运动' },
        { id: '19999999', name: '杂项' }
      ]
    }
  },
  mutations: {
    setCategorys(state, newcategorys) {
      state.categorys = newcategorys
    }
  },
  actions: {
    async getCategorys(context) {
      const { result } = await Category()
      // console.log(result)
      context.commit('setCategorys', result)
    }
  }
}
